<template>
  <el-container class="layout-container-demo" style="height:100%">
    <el-aside width="auto">
      <el-scrollbar>
        <el-menu 
         :collapse="isCollapse"
         collapse-transition  
         @open="handleOpen"
         @close="handleClose"
          >
        <el-menu-item index="1"  @click="home">
          <el-icon><HomeFilled /></el-icon>
          <span >首页</span>
            <!-- <template #title>
                 <el-icon><HomeFilled /></el-icon>
              <el-menu-item index="1-1" @click="home">首页</el-menu-item>
            </template>            -->
          </el-menu-item >

          <el-menu-item index="2"  @click="users">
            <el-icon><UserFilled /></el-icon>
            <span>用户管理</span>
          </el-menu-item >
          <el-sub-menu index="3">
            <template #title>
              <el-icon><Goods /></el-icon> 
                <!-- <el-menu-item index="3-1" >商品管理</el-menu-item> -->
                <span>商品管理</span>
            </template>      
              <!-- <template #title>Group 1</template> -->
             
              <el-menu-item index="3-1" @click="recommend">猜你喜欢商品管理</el-menu-item>
              <el-menu-item index="3-2" @click="like">经典商品管理</el-menu-item>
              <el-menu-item index="3-3"  @click="goods">所有商品管理</el-menu-item>
       
          </el-sub-menu>
            <el-sub-menu index="4">
            <template #title>
              <el-icon><List /></el-icon>
               <!-- <el-menu-item index="4-1" >订单管理</el-menu-item> -->
               <span>订单管理 </span>
            </template>
            <el-menu-item-group>
              <!-- <template #title>Group 1</template> -->
              <el-menu-item index="4-1" @click="zhifu">订单发货</el-menu-item>
                <el-menu-item index="4-2" @click="success">订单退换货</el-menu-item>             
            </el-menu-item-group>
          </el-sub-menu>
        </el-menu>
      </el-scrollbar>
    </el-aside>

    <el-container>
      <el-header>
        <div>
           
      <el-switch
        v-model="isCollapse"
        class="ml-2"
        style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
  />
         

          <img src="../assets/logo.png" alt="">
        </div>
        <div class="toolbar">
        <span>钟表商城后台管理</span>
          
        </div>  
        <div>
          <div>admin</div>
          <div style="margin-top: 10px;" @click="login_out">退出登录</div>
        </div>
      </el-header>
      

      <el-main>
        <el-scrollbar>

        
           <router-view></router-view>
        </el-scrollbar>
      </el-main>
    </el-container>
  </el-container>
</template>



<script>
import {HomeFilled,UserFilled,Goods,List } from "@element-plus/icons-vue"
export default{
    name:"boot",
    data() {
        return {
            isCollapse: "" 
        }
    },
    components:{
      HomeFilled,
      UserFilled,
      Goods,
      List 
    },
    created(){
            //  this.home()
    },
    mounted(){
       
    },
    methods: {
      login_out(){
         this.$router.push("/")
      },
        goods(){
            this.$router.push("/goods")
        },
        users(){
            this.$router.push("/users")
        },
        admin(){
            this.$router.push("/admin")
        },
        recommend(){
            this.$router.push("/recommend")
        },
        like(){
            this.$router.push("/like")
        },
     
       zhifu(){
           this.$router.push("/parment")
       },
       success(){
           this.$router.push("/success")
       },
       home(){
           this.$router.push("/home")
       }
    },
}
</script>

<style scoped>
.layout-container-demo .el-header {
  position: relative;
  background-color:rgb(215, 255, 190);
  color: var(--el-text-color-primary);
}
.layout-container-demo .el-aside {
  height: 100%;
  color:rgb(215, 255, 190);
  background:rgb(215, 255, 190);
}
.layout-container-demo .el-menu {
  height: 100%;
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
}
.layout-container-demo .toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
.el-header{
  display: flex;
  justify-content: space-between;
  
}
img{
    width: 150px;
    height: 60px;  
}
::v-deep .el-switch__core{
  margin-bottom: 45px;
}
</style>